﻿// Spaceship Duel Configuration Tool
// ---------------------------------
// Created by Nico König
// This program is licenced under Creative Commons CC BY 4.0: https://creativecommons.org/licenses/by/4.0/

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
using System.Xml.Serialization;

namespace SpaceshipDuelConfig
{
    /// <summary>
    /// Struktur für Bildschirmauflösung
    /// </summary>
    struct Resolution
    {
        public Resolution(int newWidth, int newHeight, string newName)
        {
            width   = newWidth;
            height  = newHeight;
            name    = newName;
        }

        public int width;   // Breite in Pixel
        public int height;  // Höhe in Pixel
        public string name; // Name im Format "BreitexHöhe"
    }

    /// <summary>
    /// Form-Klasse
    /// </summary>
    public partial class FormMain : Form
    {
        #region Private fields

        List<Resolution> resolutions;   // Liste der Auflösungen
        ConfigData confData;            // Objekt zur XML-Serialisierung und Deserialisierung
        string language;

        #endregion Private fields

        #region Construction

        /// <summary>
        /// Standard-Konstruktor
        /// </summary>
        public FormMain()
        {
            resolutions = new List<Resolution>();
            confData = new ConfigData(-1, -1, true, 50, 100, "W", "S", "A", "D", "Strg links", "Shift links", "Cursor hoch", "Cursor runter", "Cursor links", "Cursor rechts", "Strg rechts", "Shift rechts", 0, false, 2, 2, 2, 5, "Deutsch");
            InitializeComponent();
        }

        #endregion Construction

        #region Private methods

        /// <summary>
        /// Shown-Methode der Form
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FormMain_Shown(object sender, EventArgs e)
        {
            // Liste der auswählbaren Auflösungen anlegen
            resolutions.Add(new Resolution(  -1,   -1, "auto"));
            resolutions.Add(new Resolution( 800,  600, "800x600"));
            resolutions.Add(new Resolution(1024,  768, "1024x768"));
            resolutions.Add(new Resolution(1280,  720, "1280x720"));
            resolutions.Add(new Resolution(1280,  800, "1280x800"));
            resolutions.Add(new Resolution(1280,  960, "1280x960"));
            resolutions.Add(new Resolution(1400, 1050, "1400x1050"));
            resolutions.Add(new Resolution(1440,  900, "1440x900"));
            resolutions.Add(new Resolution(1600,  900, "1600x900"));
            resolutions.Add(new Resolution(1600, 1200, "1600x1200"));
            resolutions.Add(new Resolution(1680, 1050, "1680x1050"));
            resolutions.Add(new Resolution(1920, 1080, "1920x1080"));
            resolutions.Add(new Resolution(1920, 1200, "1920x1200"));
            resolutions.Add(new Resolution(1920, 1440, "1920x1440"));

            for (int i=0; i<resolutions.Count; i++)
                comboBoxResolution.Items.Add(resolutions[i].name);

            comboBoxResolution.SelectedIndex = 0;

            comboBoxLanguage.SelectedIndex = 0;
            language = "Deutsch";

            ReadConfig();

            if (comboBoxLanguage.SelectedIndex > -1)
                SetLanguage(comboBoxLanguage.Items[comboBoxLanguage.SelectedIndex].ToString());
        }

        /// <summary>
        /// Einlesen der Konfiguration, Darstellung der gespeicherten Parameter
        /// </summary>
        private void ReadConfig()
        {
            try
            {
                confData = DeserializeFromXml();

                if (confData.FullscreenMode == true)
                    radioButtonFullscreenMode.Checked = true;
                else
                    radioButtonWindowMode.Checked = true;

                string resName = confData.ResolutionWidth.ToString() + "x" + confData.ResolutionHeight.ToString();

                if (comboBoxResolution.Items.Contains(resName) == true)
                    comboBoxResolution.SelectedIndex = comboBoxResolution.Items.IndexOf(resName);
                else
                    comboBoxResolution.SelectedIndex = 0;

                if (confData.VolumeMusic >= 0 && confData.VolumeMusic <= 100)
                    trackBarVolumeMusic.Value = confData.VolumeMusic;
                else
                    trackBarVolumeMusic.Value = 100;

                if (confData.VolumeSfx >= 0 && confData.VolumeSfx <= 100)
                    trackBarVolumeSfx.Value = confData.VolumeSfx;
                else
                    trackBarVolumeSfx.Value = 100;

                if (cbPlayer1Up.Items.Contains(confData.Player1KeyUp) == true)
                    cbPlayer1Up.SelectedIndex = cbPlayer1Up.Items.IndexOf(confData.Player1KeyUp);
                else
                    cbPlayer1Up.SelectedIndex = 0;

                if (cbPlayer1Down.Items.Contains(confData.Player1KeyDown) == true)
                    cbPlayer1Down.SelectedIndex = cbPlayer1Down.Items.IndexOf(confData.Player1KeyDown);
                else
                    cbPlayer1Down.SelectedIndex = 0;

                if (cbPlayer1Left.Items.Contains(confData.Player1KeyLeft) == true)
                    cbPlayer1Left.SelectedIndex = cbPlayer1Left.Items.IndexOf(confData.Player1KeyLeft);
                else
                    cbPlayer1Left.SelectedIndex = 0;

                if (cbPlayer1Right.Items.Contains(confData.Player1KeyRight) == true)
                    cbPlayer1Right.SelectedIndex = cbPlayer1Right.Items.IndexOf(confData.Player1KeyRight);
                else
                    cbPlayer1Right.SelectedIndex = 0;

                if (cbPlayer1Fire.Items.Contains(confData.Player1KeyFire) == true)
                    cbPlayer1Fire.SelectedIndex = cbPlayer1Fire.Items.IndexOf(confData.Player1KeyFire);
                else
                    cbPlayer1Fire.SelectedIndex = 0;

                if (cbPlayer1Special.Items.Contains(confData.Player1KeySpecial) == true)
                    cbPlayer1Special.SelectedIndex = cbPlayer1Special.Items.IndexOf(confData.Player1KeySpecial);
                else
                    cbPlayer1Special.SelectedIndex = 0;

                if (cbPlayer2Up.Items.Contains(confData.Player2KeyUp) == true)
                    cbPlayer2Up.SelectedIndex = cbPlayer2Up.Items.IndexOf(confData.Player2KeyUp);
                else
                    cbPlayer2Up.SelectedIndex = 0;

                if (cbPlayer2Down.Items.Contains(confData.Player2KeyDown) == true)
                    cbPlayer2Down.SelectedIndex = cbPlayer2Down.Items.IndexOf(confData.Player2KeyDown);
                else
                    cbPlayer2Down.SelectedIndex = 0;

                if (cbPlayer2Left.Items.Contains(confData.Player2KeyLeft) == true)
                    cbPlayer2Left.SelectedIndex = cbPlayer2Left.Items.IndexOf(confData.Player2KeyLeft);
                else
                    cbPlayer2Left.SelectedIndex = 0;

                if (cbPlayer2Right.Items.Contains(confData.Player2KeyRight) == true)
                    cbPlayer2Right.SelectedIndex = cbPlayer2Right.Items.IndexOf(confData.Player2KeyRight);
                else
                    cbPlayer2Right.SelectedIndex = 0;

                if (cbPlayer2Fire.Items.Contains(confData.Player2KeyFire) == true)
                    cbPlayer2Fire.SelectedIndex = cbPlayer2Fire.Items.IndexOf(confData.Player2KeyFire);
                else
                    cbPlayer2Fire.SelectedIndex = 0;

                if (cbPlayer2Special.Items.Contains(confData.Player2KeySpecial) == true)
                    cbPlayer2Special.SelectedIndex = cbPlayer2Special.Items.IndexOf(confData.Player2KeySpecial);
                else
                    cbPlayer2Special.SelectedIndex = 0;

                if (confData.Asteroids >= 0 && confData.Asteroids <= 4)
                    comboBoxAsteroids.SelectedIndex = confData.Asteroids;
                else
                    comboBoxAsteroids.SelectedIndex = 2;

                if (confData.Enemies >= 0 && confData.Enemies <= 4)
                    comboBoxEnemies.SelectedIndex = confData.Enemies;
                else
                    comboBoxEnemies.SelectedIndex = 2;

                if (confData.WorldSize >= 0 && confData.WorldSize <= 5)
                    comboBoxWorldSize.SelectedIndex = confData.WorldSize;
                else
                    comboBoxAsteroids.SelectedIndex = 0;

                checkBoxFPS.Checked = confData.FPS;

                comboBoxPartikel.SelectedIndex = confData.Particles;

                if (confData.Lives > 0)
                    numericUpDownLife.Value = confData.Lives;
                else
                    numericUpDownLife.Value = 5;

                if (confData.Language == "English")
                    comboBoxLanguage.SelectedIndex = 1;
                else
                    comboBoxLanguage.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Fehler beim Einlesen der Konfigurationsdatei: " + ex.Message, "Fehler");
            }
        }

        /// <summary>
        /// Speichern-Button wurde gedrückt
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonSaveConfig_Click(object sender, EventArgs e)
        {
            DisableGUI(true);
            try
            {
                confData.FullscreenMode     = radioButtonFullscreenMode.Checked;
                confData.ResolutionWidth    = resolutions[comboBoxResolution.SelectedIndex].width;
                confData.ResolutionHeight   = resolutions[comboBoxResolution.SelectedIndex].height;
                confData.VolumeMusic        = trackBarVolumeMusic.Value;
                confData.VolumeSfx          = trackBarVolumeSfx.Value;
                confData.Player1KeyDown     = Dictionary.GetRefString(cbPlayer1Down.Items[cbPlayer1Down.SelectedIndex].ToString(), this.language);
                confData.Player1KeyFire     = Dictionary.GetRefString(cbPlayer1Fire.Items[cbPlayer1Fire.SelectedIndex].ToString(), this.language);
                confData.Player1KeyLeft     = Dictionary.GetRefString(cbPlayer1Left.Items[cbPlayer1Left.SelectedIndex].ToString(), this.language);
                confData.Player1KeyRight    = Dictionary.GetRefString(cbPlayer1Right.Items[cbPlayer1Right.SelectedIndex].ToString(), this.language);
                confData.Player1KeySpecial  = Dictionary.GetRefString(cbPlayer1Special.Items[cbPlayer1Special.SelectedIndex].ToString(), this.language);
                confData.Player1KeyUp       = Dictionary.GetRefString(cbPlayer1Up.Items[cbPlayer1Up.SelectedIndex].ToString(), this.language);
                confData.Player2KeyDown     = Dictionary.GetRefString(cbPlayer2Down.Items[cbPlayer2Down.SelectedIndex].ToString(), this.language);
                confData.Player2KeyFire     = Dictionary.GetRefString(cbPlayer2Fire.Items[cbPlayer2Fire.SelectedIndex].ToString(), this.language);
                confData.Player2KeyLeft     = Dictionary.GetRefString(cbPlayer2Left.Items[cbPlayer2Left.SelectedIndex].ToString(), this.language);
                confData.Player2KeyRight    = Dictionary.GetRefString(cbPlayer2Right.Items[cbPlayer2Right.SelectedIndex].ToString(), this.language);
                confData.Player2KeySpecial  = Dictionary.GetRefString(cbPlayer2Special.Items[cbPlayer2Special.SelectedIndex].ToString(), this.language);
                confData.Player2KeyUp       = Dictionary.GetRefString(cbPlayer2Up.Items[cbPlayer2Up.SelectedIndex].ToString(), this.language);
                confData.Particles          = comboBoxPartikel.SelectedIndex;
                confData.FPS                = checkBoxFPS.Checked;
                confData.WorldSize          = comboBoxWorldSize.SelectedIndex;
                confData.Asteroids          = comboBoxAsteroids.SelectedIndex;
                confData.Enemies            = comboBoxEnemies.SelectedIndex;
                confData.Lives              = (int)numericUpDownLife.Value;
                confData.Language           = comboBoxLanguage.Items[comboBoxLanguage.SelectedIndex].ToString();
                SerializeToXML(confData);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Fehler beim Speichern der Konfigurationsdatei: " + ex.Message, "Fehler");
            }
            finally
            {
                DisableGUI(false);
            }
        }

        /// <summary>
        /// Serialisierung in XML-Datei (Speichern)
        /// </summary>
        /// <param name="dataObj"></param>
        private void SerializeToXML(ConfigData dataObj)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(ConfigData));
            FileStream file = new FileStream(Application.StartupPath + "\\config.xml", FileMode.Create);
            serializer.Serialize(file, dataObj);
            file.Close();
        }

        /// <summary>
        /// Deserialisierung aus XML-Datei (Laden)
        /// </summary>
        /// <returns></returns>
        private ConfigData DeserializeFromXml()
        {
            XmlSerializer serializer = new XmlSerializer(typeof(ConfigData));
            FileStream file = new FileStream(Application.StartupPath + "\\config.xml", FileMode.Open);
            ConfigData myData = serializer.Deserialize(file) as ConfigData;
            file.Close();
            return myData;
        }

        /// <summary>
        /// GUI-Elemente sperren/entsperren
        /// </summary>
        /// <param name="disable"></param>
        private void DisableGUI(bool disable)
        {
            buttonSaveConfig.Enabled            = !disable;
            buttonStartGame.Enabled             = !disable;
            comboBoxResolution.Enabled          = !disable;
            radioButtonFullscreenMode.Enabled   = !disable;
            radioButtonWindowMode.Enabled       = !disable;
            trackBarVolumeMusic.Enabled         = !disable;
            trackBarVolumeSfx.Enabled           = !disable;
            cbPlayer1Down.Enabled               = !disable;
            cbPlayer1Fire.Enabled               = !disable;
            cbPlayer1Left.Enabled               = !disable;
            cbPlayer1Right.Enabled              = !disable;
            cbPlayer1Special.Enabled            = !disable;
            cbPlayer1Up.Enabled                 = !disable;
            cbPlayer2Down.Enabled               = !disable;
            cbPlayer2Fire.Enabled               = !disable;
            cbPlayer2Left.Enabled               = !disable;
            cbPlayer2Right.Enabled              = !disable;
            cbPlayer2Special.Enabled            = !disable;
            cbPlayer2Up.Enabled                 = !disable;
            comboBoxPartikel.Enabled            = !disable;
            checkBoxFPS.Enabled                 = !disable;
            comboBoxAsteroids.Enabled           = !disable;
            comboBoxEnemies.Enabled             = !disable;
            comboBoxWorldSize.Enabled           = !disable;
            numericUpDownLife.Enabled           = !disable;
            comboBoxLanguage.Enabled            = !disable;
        }

        /// <summary>
        /// Änderung des Volumewertes der Musik mittels Trackbar
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void trackBarVolumeMusic_ValueChanged(object sender, EventArgs e)
        {
            labelVolumeMusic.Text = string.Format("{0}%", trackBarVolumeMusic.Value);
        }

        /// <summary>
        /// Änderung des Volumewertes der Soundeffekte mittels Trackbar
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void trackBarVolumeSfx_ValueChanged(object sender, EventArgs e)
        {
            labelVolumeSfx.Text = string.Format("{0}%", trackBarVolumeSfx.Value);
        }

        /// <summary>
        /// Startet die Exe des Spiels
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonStartGame_Click(object sender, EventArgs e)
        {
            try
            {
                buttonSaveConfig_Click(sender, null);
                Process.Start("SpaceshipDuel.exe");
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Das Spiel SpaceshipDuel konnte nicht gestartet werden. (" + ex.Message + ")", "Fehler");
            }
        }

        /// <summary>
        /// Klick Combobox Sprachauswahl
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void comboBoxLanguage_SelectedValueChanged(object sender, EventArgs e)
        {
            SetLanguage(comboBoxLanguage.Items[comboBoxLanguage.SelectedIndex].ToString());
        }

        /// <summary>
        /// Übersetzung aller GUI-Elemente 
        /// </summary>
        /// <param name="language">Sprache</param>
        private void SetLanguage(string language)
        {
            this.language = language;

            // Form
            this.Text = Dictionary.GetTranslation("Spaceship Duel Konfiguration", language);
            this.buttonSaveConfig.Text = Dictionary.GetTranslation("Speichere Konfiguration", language);
            this.buttonStartGame.Text = Dictionary.GetTranslation("Starte Spiel", language);

            // Tab control
            tabControl1.TabPages[0].Text = Dictionary.GetTranslation("Grafik", language);
            tabControl1.TabPages[1].Text = Dictionary.GetTranslation("Sound", language);
            tabControl1.TabPages[2].Text = Dictionary.GetTranslation("Steuerung", language);
            tabControl1.TabPages[3].Text = Dictionary.GetTranslation("Spiel", language);
            SetComboboxPartikel(language);

            // Tab page 1 = Grafik
            labelResolution.Text = Dictionary.GetTranslation("Bildschirmauflösung:", language);
            radioButtonFullscreenMode.Text = Dictionary.GetTranslation("Vollbildmodus", language);
            radioButtonWindowMode.Text = Dictionary.GetTranslation("Fenster", language);
            labelPartikel.Text = Dictionary.GetTranslation("Partikeleffekte:", language);
            checkBoxFPS.Text = Dictionary.GetTranslation("Anzahl der Frames pro Sekunde (FPS) einblenden", language);

            // Tab page 2 = Sound
            labelMusic.Text = Dictionary.GetTranslation("Lautstärke Musik:", language);
            labelSfx.Text = Dictionary.GetTranslation("Lautstärke Soundeffekte:", language);

            // Tab page 3 = Steuerung
            groupBox1.Text = Dictionary.GetTranslation("Spieler 1", language);
            groupBox2.Text = Dictionary.GetTranslation("Spieler 2", language);
            labelS1Vor.Text = Dictionary.GetTranslation("Vorwärts", language);
            labelS2Vor.Text = Dictionary.GetTranslation("Vorwärts", language);
            labelS1Zurück.Text = Dictionary.GetTranslation("Rückwärts", language);
            labelS2Zurück.Text = Dictionary.GetTranslation("Rückwärts", language);
            labelS1Links.Text = Dictionary.GetTranslation("Links drehen", language);
            labelS2Links.Text = Dictionary.GetTranslation("Links drehen", language);
            labelS1Rechts.Text = Dictionary.GetTranslation("Rechts drehen", language);
            labelS2Rechts.Text = Dictionary.GetTranslation("Rechts drehen", language);
            labelS1Feuer.Text = Dictionary.GetTranslation("Feuer", language);
            labelS2Feuer.Text = Dictionary.GetTranslation("Feuer", language);
            labelS1Spezial.Text = Dictionary.GetTranslation("Spezial", language);
            labelS2Spezial.Text = Dictionary.GetTranslation("Spezial", language);
            SetComboboxSteuerung(language, ref cbPlayer1Down);
            SetComboboxSteuerung(language, ref cbPlayer1Fire);
            SetComboboxSteuerung(language, ref cbPlayer1Left);
            SetComboboxSteuerung(language, ref cbPlayer1Right);
            SetComboboxSteuerung(language, ref cbPlayer1Special);
            SetComboboxSteuerung(language, ref cbPlayer1Up);
            SetComboboxSteuerung(language, ref cbPlayer2Down);
            SetComboboxSteuerung(language, ref cbPlayer2Fire);
            SetComboboxSteuerung(language, ref cbPlayer2Left);
            SetComboboxSteuerung(language, ref cbPlayer2Right);
            SetComboboxSteuerung(language, ref cbPlayer2Special);
            SetComboboxSteuerung(language, ref cbPlayer2Up);

            // Tab page 4 = Spiel
            labelWorldSize.Text = Dictionary.GetTranslation("Spielfeldgröße:", language);
            labelAsteroids.Text = Dictionary.GetTranslation("Anzahl Asteroiden:", language);
            labelEnemies.Text = Dictionary.GetTranslation("Anzahl Gegner:", language);
            labelLives.Text = Dictionary.GetTranslation("Anzahl Leben:", language);
            SetComboboxWorldsize(language);
            SetComboboxAsteroids(language);
            SetComboboxEnemies(language);
        }

        /// <summary>
        /// Übersetze Partikel-Combobox
        /// </summary>
        /// <param name="language">Sprache</param>
        private void SetComboboxPartikel(string language)
        {
            int index = comboBoxPartikel.SelectedIndex;
            comboBoxPartikel.Items.Clear();
            comboBoxPartikel.Items.Add(Dictionary.GetTranslation("keine", language));
            comboBoxPartikel.Items.Add(Dictionary.GetTranslation("wenig", language));
            comboBoxPartikel.Items.Add(Dictionary.GetTranslation("normal", language));
            comboBoxPartikel.Items.Add(Dictionary.GetTranslation("viele", language));
            comboBoxPartikel.Items.Add(Dictionary.GetTranslation("sehr viele", language));
            comboBoxPartikel.SelectedIndex = index;
        }

        /// <summary>
        /// Übersetze Steuerung-Comboboxen
        /// </summary>
        /// <param name="language">Sprache</param>
        /// <param name="cb">Referenz auf Combobox</param>
        private void SetComboboxSteuerung(string language, ref ComboBox cb)
        {
            int index = cb.SelectedIndex;
            cb.Items.Clear();
            cb.Items.Add("1");  // Zahlen und Buchstaben müssen nicht übersetzt werden
            cb.Items.Add("2");
            cb.Items.Add("3");
            cb.Items.Add("4");
            cb.Items.Add("5");
            cb.Items.Add("6");
            cb.Items.Add("7");
            cb.Items.Add("8");
            cb.Items.Add("9");
            cb.Items.Add("0");
            cb.Items.Add("A");
            cb.Items.Add("B");
            cb.Items.Add("C");
            cb.Items.Add("D");
            cb.Items.Add("E");
            cb.Items.Add("F");
            cb.Items.Add("G");
            cb.Items.Add("H");
            cb.Items.Add("I");
            cb.Items.Add("J");
            cb.Items.Add("K");
            cb.Items.Add("L");
            cb.Items.Add("M");
            cb.Items.Add("N");
            cb.Items.Add("O");
            cb.Items.Add("P");
            cb.Items.Add("Q");
            cb.Items.Add("R");
            cb.Items.Add("S");
            cb.Items.Add("T");
            cb.Items.Add("U");
            cb.Items.Add("V");
            cb.Items.Add("W");
            cb.Items.Add("X");
            cb.Items.Add("Y");
            cb.Items.Add("Z");
            cb.Items.Add(Dictionary.GetTranslation("Alt links", language));
            cb.Items.Add(Dictionary.GetTranslation("Alt rechts", language));
            cb.Items.Add(Dictionary.GetTranslation("Cursor hoch", language));
            cb.Items.Add(Dictionary.GetTranslation("Cursor runter", language));
            cb.Items.Add(Dictionary.GetTranslation("Cursor links", language));
            cb.Items.Add(Dictionary.GetTranslation("Cursor rechts", language));
            cb.Items.Add(Dictionary.GetTranslation("Shift links", language));
            cb.Items.Add(Dictionary.GetTranslation("Shift rechts", language));
            cb.Items.Add(Dictionary.GetTranslation("Strg links", language));
            cb.Items.Add(Dictionary.GetTranslation("Strg rechts", language));
            cb.Items.Add(Dictionary.GetTranslation("Num 0", language));
            cb.Items.Add(Dictionary.GetTranslation("Num 1", language));
            cb.Items.Add(Dictionary.GetTranslation("Num 2", language));
            cb.Items.Add(Dictionary.GetTranslation("Num 3", language));
            cb.Items.Add(Dictionary.GetTranslation("Num 4", language));
            cb.Items.Add(Dictionary.GetTranslation("Num 5", language));
            cb.Items.Add(Dictionary.GetTranslation("Num 6", language));
            cb.Items.Add(Dictionary.GetTranslation("Num 7", language));
            cb.Items.Add(Dictionary.GetTranslation("Num 8", language));
            cb.Items.Add(Dictionary.GetTranslation("Num 9", language));
            cb.SelectedIndex = index;
        }

        /// <summary>
        /// Übersetze Spielfeldgröße-Combobox
        /// </summary>
        /// <param name="language">Sprache</param>
        private void SetComboboxWorldsize(string language)
        {
            int index = comboBoxWorldSize.SelectedIndex;
            comboBoxWorldSize.Items.Clear();
            comboBoxWorldSize.Items.Add(Dictionary.GetTranslation("Zufall", language));
            comboBoxWorldSize.Items.Add(Dictionary.GetTranslation("sehr klein", language));
            comboBoxWorldSize.Items.Add(Dictionary.GetTranslation("klein", language));
            comboBoxWorldSize.Items.Add(Dictionary.GetTranslation("mittel", language));
            comboBoxWorldSize.Items.Add(Dictionary.GetTranslation("groß", language));
            comboBoxWorldSize.Items.Add(Dictionary.GetTranslation("riesig", language));
            comboBoxWorldSize.SelectedIndex = index;
        }

        /// <summary>
        /// Übersetze Asteroid-Combobox
        /// </summary>
        /// <param name="language">Sprache</param>
        private void SetComboboxAsteroids(string language)
        {
            int index = comboBoxAsteroids.SelectedIndex;
            comboBoxAsteroids.Items.Clear();
            comboBoxAsteroids.Items.Add(Dictionary.GetTranslation("keine", language));
            comboBoxAsteroids.Items.Add(Dictionary.GetTranslation("wenig", language));
            comboBoxAsteroids.Items.Add(Dictionary.GetTranslation("normal", language));
            comboBoxAsteroids.Items.Add(Dictionary.GetTranslation("viele", language));
            comboBoxAsteroids.Items.Add(Dictionary.GetTranslation("sehr viele", language));
            comboBoxAsteroids.SelectedIndex = index;
        }

        /// <summary>
        /// Übersetze Gegner-Combobox
        /// </summary>
        /// <param name="language">Sprache</param>
        private void SetComboboxEnemies(string language)
        {
            int index = comboBoxEnemies.SelectedIndex;
            comboBoxEnemies.Items.Clear();
            comboBoxEnemies.Items.Add(Dictionary.GetTranslation("keine", language));
            comboBoxEnemies.Items.Add(Dictionary.GetTranslation("wenig", language));
            comboBoxEnemies.Items.Add(Dictionary.GetTranslation("normal", language));
            comboBoxEnemies.Items.Add(Dictionary.GetTranslation("viele", language));
            comboBoxEnemies.Items.Add(Dictionary.GetTranslation("sehr viele", language));
            comboBoxEnemies.SelectedIndex = index;
        }

        #endregion Private methods
    }
}
